export const state = () => ({
  loginState: false,
  userInfo: {
    name: "",
    msgNum: 0,
  },
});
export const mutations = {
  M_LOGIN(state, userInfo) {
    state.loginState = true;
    state.userInfo = userInfo;
  },
  M_LOGOUT(state) {
    state.loginState = false;
    state.userInfo = {
      name: "",
      msgNum: 0,
    };
  },
};
export const actions = {
  login({ commit }, userInfo) {
    commit("M_LOGIN", userInfo);
  },
  logout({ commit }) {
    commit("M_LOGOUT");
  },
};
